package com.bascker.beauty.builder;

import java.util.StringJoiner;

/**
 * 使用内部类来构造对象
 */
public class Api {

    private String version;

    private String path;

    public Api(final Builder builder) {
        this.version = builder.version;
        this.path = builder.path;
    }

    public static class Builder {
        private String version;

        private String path;

        public Builder version(String version) {
            this.version = version;
            return this;
        }

        public Builder path(String path) {
            this.path = path;
            return this;
        }

        public Api build() {
            return new Api(this);
        }

    }

    @Override
    public String toString() {
        return new StringJoiner(", ", Api.class.getSimpleName() + "[", "]")
                .add("version='" + version + "'")
                .add("path='" + path + "'")
                .toString();
    }
}
